﻿<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<c:set var="basePath" value="${pageContext.request.contextPath}"/>
<!DOCTYPE HTML>
<html lang="zh-cn">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>新增组织</title>
	<jsp:include page="/resources/inc/formHead.jsp" />
</head>
<body>
<form id="createForm" class="layui-form layui-form-pane" method="post">
	<div class="layui-form-item">
		<label class="layui-form-label">用户角色</label>
		<div class="layui-input-block">
			<c:forEach var="upmsRole" items="${upmsRoles}" varStatus="status">
			<input type="checkbox" name="roleId" value="${upmsRole.roleId}" title="${upmsRole.title}"
			   <c:forEach var="upmsUserRole" items="${upmsUserRoles}">
				   <c:if test="${upmsRole.roleId==upmsUserRole.roleId}">checked</c:if>
				</c:forEach>>
			</c:forEach>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="layui-input-block">
			<button class="layui-btn" lay-submit="" lay-filter="sub">立即提交</button>
			<button type="reset" class="layui-btn layui-btn-primary">重置</button>
		</div>
	</div>
</form>
<jsp:include page="/resources/inc/formFooter.jsp" />
<script>
	FormCommon.initForm({
		url: "${basePath}/manage/user/role/${user.userId}",
		editData:editData
	});

	function editData(data){
//		var roleId=[];
//		for(propKey in data){
//			if(propKey.indexOf("roleId") == 0){
//				roleId.push(data[propKey]);
//				delete data[propKey];
//			}
//		}
//		data.roleId = roleId;
//		console.log(data);
		return $('#createForm').serialize();
	}
</script>
</body>
</html>